<!--
 * @Author: 闫聪敏
 * @Email: 
 * @Date: 2020-03-04 17:31:34
 * @Descripttion: 
 -->
<!-- <div class="header">
    <form nz-form #form (ngSubmit)="search()" class="ant-advanced-search-form">
        <div nz-row nzGutter="16">
            <div nz-col nzSpan="8">
                <nz-form-item nzFlex>
                    <nz-form-label>ERP库房编号</nz-form-label>
                    <nz-form-control>
                        <input nz-input placeholder="请输入EBS库房编号" name="searchCode"
                            [(ngModel)]="searchCode" />
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="8">
                <nz-form-item nzFlex>
                    <nz-form-label>ERP库房名称</nz-form-label>
                    <nz-form-control>
                        <input nz-input placeholder="请输入EBS库房名称" name="searchName"
                            [(ngModel)]="searchName" />
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="2">
                <nz-form-item nzFlex>
                    <nz-form-control>
                        <button nz-button type="button" nzType="primary">ERP数据同步</button>
                    </nz-form-control>
                </nz-form-item>
            </div>
        </div>
    </form>
</div> -->
<div class="table-container">
    <nz-table #basicTable [nzData]="listData" nzSize="small"  nzFrontPagination="false" [nzBordered]="true" nzTitle="ERP库房列表">
        <thead>
            <tr>
                <th>ERP库房编号</th>
                <th>ERP库房名称</th>
                <th>MRP库房名称</th>
                <th nzAlign="center">操作</th>
            </tr>
        </thead>
        <tbody>
            <tr *ngFor="let data of basicTable.data">
                <td>{{ data.code }}</td>
                <td>{{ data.name }}</td>
                <td>
                    <ng-container *ngFor="let item of data.warehouses">
                        {{ item.name }}，
                    </ng-container>                    
                </td>
                <td nzAlign="center">
                    <button nz-button nzType="primary" (click)="showModal(data)"
                        style="margin-bottom: 4px;margin-right:4px" *ngIf="bornRole.add">关联</button>
                    <button nz-button nzType="danger" (click)="delete(data)" style="margin-right: 10px;" *ngIf="bornRole.del">删除</button>
                    <button nz-button nzType="" (click)="getArea(data)">查看</button>
                </td>
            </tr>
        </tbody>
    </nz-table>
</div>
<div nz-row class="page_box" style="margin-top: 20px; margin-bottom: 20px;">
    <nz-pagination (nzPageIndexChange)="listPageChange($event)" [nzPageIndex]="pageIndex"
        [nzTotal]="listCount" [nzPageSize]="pageSize" [nzShowTotal]="totalTemplate"></nz-pagination>
    <ng-template #totalTemplate let-total> 总共 {{ listCount }} 条 </ng-template>
</div>
<nz-modal appDragModal class="hmodal" [(nzVisible)]="isShow" [nzTitle]=" isDelete? '删除关联库房关系' : '关联库房关系'" [nzFooter]="null" (nzOnCancel)="handleCancel()">
    <form nz-form [formGroup]="listForm" (ngSubmit)="submitForm()">
        <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24">ERP库房</nz-form-label>
            <nz-form-control [nzSm]="14" [nzXs]="24">
                <input disabled nz-input id="code" [value]="selectItem.name" />
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>MRP库房</nz-form-label>
            <nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="请选择MRP库房">
                <nz-select nzDropdownClassName="select_custom" nzPlaceHolder="请选择" formControlName="warehouseId">
                    <nz-option *ngFor="let item of selectMrpData" [nzLabel]="item.name" [nzValue]="item.id"></nz-option>
                </nz-select>
            </nz-form-control>
        </nz-form-item>
        <div nz-row class="custome_modal_footer">
            <div nz-col nzSpan="24" style="text-align: right;">
                <button nz-button type="button" nzType="default" (click)="handleCancel()">取消</button>
                <button nz-button nzType="primary" [nzLoading]="isOkLoading">确定</button>
            </div>
        </div>
    </form>
</nz-modal>
